<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
    <form id="imgForm">
        <!-- <input type="file" class="addBorder" nonchange="checkField()"> -->
        <br/>
        <button type="button" onclick="loadImg()">获取图片</button>
    </form>
    
    <input type="file" name="txt" value="Hello" onchange="checkField(this.files)">
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>

  var code = GetQueryString('code')
  if(!code){
    $.ajax({
      type:'get',
          url:'',
          data:{
            path:'https://chestunttree.gitee.io/demo02',
            type:'synthesize' 
          },
          success:function(res){
            console.log(res)
            // if(res.data.code==200){
              window.location.href = res.body
            // }
          }
    
    })
  }else{
    // window.location.href = 'http://192.168.2.146:8080/#/?code='+code
    window.location.href = 'http://192.168.2.146:8080/?code='+code
    // window.location.href = 'http://localhost:8080/#/?code='+code
    // $.ajax({
    //   url:'',
    //   type:'post',
    //   data:{
    //     code:code,
    //     type:'synthesize'
    //   },
    //   success:function(res){
    //     console.log(res,'opopopopop')
    //   }
    // })
  }
  $('.addBorder').on('change',function(e){
    console.log(e,'eee')
  })
  function checkField(e){
    console.log(e.files,'tt')
    console.log('change')
  }
  function loadImg(){
    //获取文件
    var file = $("#imgForm").find("input")[0].files[0];
 
    //创建读取文件的对象
    var reader = new FileReader();
 
    //创建文件读取相关的变量
    var imgFile;
 
    //为文件读取成功设置事件
    reader.onload=function(e) {
        alert('文件读取完成');
        imgFile = e.target.result;
        console.log(imgFile);
        // $("#imgContent").attr('src', imgFile);
    };
  }

  function uploadImg(data){
    $.ajax({
      url:'https://www.eon.natapp1.cc/wechat/wechatHeadimg',
      type:'post',
      data:data,
      success:function(res){
        console.log(res)
      }
    })
  }

function GetQueryString(name) {
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     console.log(r)
     console.log(window.location.search)
     if(r!=null) {
         return  unescape(r[2]);
     } else {
          return null;
    }      
}
</script>
</body>
</html>